﻿using System.IO;
using UnityEditor;
using UnityEngine;

public class RemoveMetaFile
{
    [MenuItem("Tools/RemoveMetaFile")]
    public static void RemoveMetaFiles()
    {
        string[] files = Directory.GetFiles(Application.dataPath, "*.meta", SearchOption.AllDirectories);
        if (files.Length > 0)
        {
            for (int i = 0; i < files.Length; i++)
            {
                Debug.Log("<color=blue>" + files[i] + "</color>");
                EditorUtility.DisplayProgressBar("正在删除Meta", files[i], (i + 1f) / files.Length);
                File.Delete(files[i]);
            }
        }
        EditorUtility.ClearProgressBar();
    }
}